package com.health.sbcl;

import com.health.NovaActivity;
import com.health.NovaApplication;
import com.health.R;
import com.health.adapter.SbclGridAdapter;
import com.health.tablebean.ARCHIVE_BASEINFO;
import com.novabluetooth.services.lbxd.LBXD_MainActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.TextView;

/**
 * 设备测量
 * 
 * @author nova
 *
 */
public class SBCLMainActivity extends NovaActivity {
	private GridView gd_menu;
	private SbclGridAdapter menuAdapter;
	private TextView tv_name;

	private ARCHIVE_BASEINFO userinfo = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.sbcl_main);
		userinfo = NovaApplication.getUserInfo();

		findViews();
		setListeners();
	}

	@Override
	public void findViews() {
		tv_name = (TextView) findViewById(R.id.tv_name);
		tv_name.setText("欢迎  " + userinfo.getCUSTOMERNAME());
		gd_menu = (GridView) findViewById(R.id.gd_menu);
		menuAdapter = new SbclGridAdapter(getApplicationContext());
		gd_menu.setAdapter(menuAdapter);

	}

	@Override
	public void setListeners() {
		// 菜单选项
		gd_menu.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				// 0华清心电 1"返回"
				Intent intent = null;
				if (position == 0) {
					// 0 理邦心电
					intent = new Intent(getApplicationContext(), LBXD_MainActivity.class);
				} else if (position == 1) {
				}
				if(position==1){
					SBCLMainActivity.this.finish();
				}else{
					startActivity(intent);
				}
			}
		});

	}

}
